<script>
$(document).ready(function() {
	<?php
	if ($updated == 1) echo 'showNoti("Sản phẩm: '.$name.'", "Thêm sản phẩm mới thành công!", "Ok");';
	if ($failed == 1) echo 'showNoti("Sản phẩm: '.$name.'", "Xóa sản phẩm thành công!", "Err");';
    if ($orderby == 'order_new') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "new", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_hot') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "","hot", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_active') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "active","'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_best') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "best", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_cat') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "'.$cat.'", "", "'.$orderby.'", "'.$ordermode.'");';
	?>
});
</script>
<?php echo module_open(); ?>
<tr class="show640">
	<td class="head" colspan="10">
		<div class="filter_cat" style="float: left; margin-top: -5px; position: relative">
			<div class="caption" style="color: #333;">Danh mục</div><i class="icon16 glyphicons <?php echo ($filter_cat ? 'disk_saved' : 'align_left') ?>"></i>
			<div class="filter_cat_list" style="position: absolute; top: 40px; left: 5px; z-index: 12"><ul class="cat_treeview filetree treeview" style="height: 200px !important;"><?php echo cat_tree($cat_list, 0, $filter_cat, 'radio', true) ?></ul></div>
		</div>
	</td>
</tr>
<?php
if ($page_list)
{
?>
<tr class="show980">
	<td class="fr page" colspan="10">
		<?php echo $page_list ?>
	</td>
</tr>
<?php
}
?>
<tr class="nodrop">
    <?php if ($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
	<td class="head center" width="2%"><?php echo create_sort('id') ?>#</td>
	<td class="head" width="10%">Mã sản phẩm</td>
  	<td class="head" width="20%"><?php echo create_sort('name_vn') ?>Tên sản phẩm</td>
  	<td class="head center hide480" width="4%">Hình ảnh</td>
    <td class="head right hide640" width="5%"><?php echo create_sort('gia1') ?>Giá bán</td>
    <td class="head center hide768" width="5%"><?php echo create_sort('order_best') ?>Noi bat</td>
    <td class="head center hide768" width="5%"><?php echo create_sort('order_hot') ?>Hot</td>    
    <td class="head center hide640" width="5%"><?php echo create_sort('order_active') ?>Kích hoạt</td>
    <td class="head center" width="1%">&nbsp;</td>
</tr>
<?php
if(count($products) && is_array($products))
{
	$i = 0;
	foreach ($products as $row)
	{
		$row['tonkho'] = $row['nhapkho'] - $row['xuatkho'] - $row['trahang'] - $row['huyhang'];
?>
<tr class="highlight<?php echo ($row['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $row['id'] ?>" name="<?php echo $row['name_vn'] ?>">
	<?php if ($GLOBALS['per']['del']) echo '<td class="fr center">'.sel_item($row['id']).'</td>'; ?>
	<td class="fr center"><?php echo stt($row['id'], $GLOBALS['var']['rowstart'] + $i + 1) ?></td>
	<td class="fr nowrap"><?php echo $row['code'] ?></td>
	<td class="fr nowrap"><span id="name_<?php echo $row['id'] ?>"><a href="<?php echo current_url().'/update/'.$row['id'].$uri_str ?>"><?php echo $row['name_vn'] ?></a></span></td>
	<td class="fr center hide480" style="height:35px;"><?php echo show_img(PRO.'thumbs/'.$row['img'], '', 'max-width:35px; max-height:35px;') ?></td>
	<td class="fr right hide640"><?php echo number_format($row['gia2']) ?></td>
	<td class="fr center hide768"><?php echo change_status($row['id'], $row['best'], 'best', 'Mới về', '', '', !$GLOBALS['per']['edit']) ?></td>
    <td class="fr center hide768"><?php echo change_status($row['id'], $row['hot'], 'hot', 'Hot', '', '', !$GLOBALS['per']['edit']) ?></td>    
	<td class="fr center hide640"><?php echo change_status($row['id'], $row['active'], 'active', 'Kích hoạt', '', '', !$GLOBALS['per']['edit']) ?></td>
	<td class="fr center" nowrap="nowrap">
		<?php
		if ($GLOBALS['per']['edit']) echo edit_alink('', current_url().'/update/'.$row['id'].$uri_str, 'hide480');
		if ($GLOBALS['per']['del']) echo del_restore_link($row['id'], $row['deleted']);
		?>
	</td>
</tr>
<?php
		$i++;
	}
}
else
{
	echo no_data_mes(11);
}
echo module_close();
?>
<div class="addDiv"><div></div></div>